package com.google.coffeeshop.gui.desktop.statistics;

import java.awt.GridLayout;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.FlowLayout;

public class StatisticsActionsPanel extends JPanel {
	public StatisticsActionsPanel(final StatisticsPanel panel) {
		
		JToolBar toolBar = new JToolBar();
		
		JButton btnInventory = new JButton("Inventory");
		btnInventory.setVerticalTextPosition(SwingConstants.BOTTOM);
		btnInventory.setHorizontalTextPosition(SwingConstants.CENTER);
		btnInventory.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				StatisticsPanel.action=1;
				panel.refreshGUI();
			}
		});
		setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
		btnInventory.setIcon(new ImageIcon(StatisticsActionsPanel.class.getResource("/com/google/coffeeshop/gui/desktop/icon/size24/inventory-24.png")));
		toolBar.add(btnInventory);
		
		JButton btnImport = new JButton("Import");
		btnImport.setVerticalTextPosition(SwingConstants.BOTTOM);
		btnImport.setHorizontalTextPosition(SwingConstants.CENTER);
		btnImport.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				StatisticsPanel.action=2;
				panel.refreshGUI();
			}
		});
		btnImport.setIcon(new ImageIcon(StatisticsActionsPanel.class.getResource("/com/google/coffeeshop/gui/desktop/icon/size24/import-24.png")));
		toolBar.add(btnImport);
		
		JButton btnExport = new JButton("Export");
		btnExport.setVerticalTextPosition(SwingConstants.BOTTOM);
		btnExport.setHorizontalTextPosition(SwingConstants.CENTER);
		btnExport.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				StatisticsPanel.action=3;
				panel.refreshGUI();
				
			}
		});
		btnExport.setIcon(new ImageIcon(StatisticsActionsPanel.class.getResource("/com/google/coffeeshop/gui/desktop/icon/size24/export-24.png")));
		toolBar.add(btnExport);
		
		JButton btnSaleIncome = new JButton("Sale & Income");
		btnSaleIncome.setVerticalTextPosition(SwingConstants.BOTTOM);
		btnSaleIncome.setHorizontalTextPosition(SwingConstants.CENTER);
		btnSaleIncome.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				StatisticsPanel.action=4;
				panel.refreshGUI();
			}
		});
		btnSaleIncome.setIcon(new ImageIcon(StatisticsActionsPanel.class.getResource("/com/google/coffeeshop/gui/desktop/icon/size24/sales-income-24.png")));
		toolBar.add(btnSaleIncome);
		
		add(toolBar);
	}
	
	private static final long serialVersionUID = 1L;

}
